layui.use(['table', 'laypage', 'layer', 'form', 'laytpl'], function() {
	var $ = layui.$;
	var table = layui.table;
	var layer = layui.layer;
	var laytpl = layui.laytpl;
	var ordernumber;
	$("#searchBtn").click(function() {
		ordernumber = $("#ordernumber").val();
		if(ordernumber==""){
			layer.msg("请输入搜索条件",{time:500});
		}else{
			getdistributed();
		}
	});
	$("#reLoad").click(function() {
		ordernumber = "";
		layer.msg("刷新", {
			time: 500
		}, function() {
			getdistributed();
		});
	});
	getdistributed();
	function getdistributed() {
		$.ajax({
			type: "post",
			url: "/distribute/finished",
			async: true,
			data:{
				ordernumber:ordernumber
			},
			success: function(data) {
				var result = $.parseJSON(data);
				var tablelist = table.render({
					elem: '#test',
					height: 'full-95',
					page: true, //开启分页,
					limits: [10],
					limit: 10,
					id: 'table_reload',
					cols: [
						[ //表头
							{
								checkbox: true,
								fixed: true
							},
							{
								field: 'orderman',
								title: '客户姓名',
								width: 150,
							}, {
								field: 'ordernumber',
								title: '订单编号',
								width: 150,
								sort: true,
							}, {
								field: 'ordercontxt',
								title: '订单内容',
								width: 150,
							}, {
								field: 'ordertime',
								title: '下单时间',
								width: 130
							}, {
								field: 'orderdate',
								title: '下单日期',
								width: 130
							},{
								field:'distributeman',
								title:'配送人员',
								width:130
							},
							{
								field:'distributestarttime',
								title:'配送开始时间',
								width:130
							},
							{
								field:'distributeovertime',
								title:'完成时间',
								width:130
							},
							{
								fixed: 'right',
								title: '操作',
								width: 300,
								align: 'center',
								toolbar: '#barDemo'
							}
						]
					],
					"data": result
				});
			}
		});
	}
	//分页
	

});